const express = require('express');
const path = require('path');
const app = express();
// 指定文件夹下的所有资源暴露出去
// http://localhost:3000/index.html
// app.use(express.static('public'));

// http://localhost:3000/laoxi.html
// http://localhost:3000/laoxi.html
// app.use(express.static('./public/laoxi'));
// app.use(express.static(path.join(__dirname, 'public', 'laoxi')));

// http://localhost:3000/static/img/7.jpg
// app.use('/static', express.static('public'));


// http://localhost:3000/static/laoxi.html
app.use('/static', express.static(path.join(__dirname, 'public', 'laoxi')));



app.get('/', (req, res) => {

    res.send('xxx');

})
app.listen(3000, err => {
    if (!err) console.log('server启动');
    else console.log(err);
})